﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ERP_RORZE_SYSTEM;

namespace ERP_RORZE_DLL.Assembly
{
    public partial class panel_F4TimeMonthlyReport : UserControl
    {
        public panel_F4TimeMonthlyReport()
        {
            InitializeComponent();            
            this.yearText.Text = DateTime.Now.Year.ToString();
        }

        private void buttonView_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.yearText.Text.Trim()))
            {
                MessageBox.Show("Please enter Year to view report");
            }
            else
            {
                reportDocument.DocumentSource = null;
                rpt_F4TimeMonthly F4TimeMonthly = new rpt_F4TimeMonthly();
                F4TimeMonthly.year = this.yearText.Text.Trim();
                double plan_check2 = 0;
                if (double.TryParse(this.planValue.Text.Trim(), out plan_check2))
                {
                    F4TimeMonthly.plan = this.planValue.Text.Trim();
                    F4TimeMonthly.LoadData();
                    F4TimeMonthly.CreateDocument();
                    reportDocument.DocumentSource = F4TimeMonthly;
                }
                else
                {
                    MessageBox.Show("Invalid Plan");
                }
            } 
        }
    }
}
